package com.lkm.app_ui.m.Imple.hsj522;

import com.lkm.javatool.NumberHelp;





public class SendGetCardNumCMDTask extends AbsCMDSendTask<Void, String> {


    @Override
    protected void receiveResult(ReadResponEntity respon, int requestContinueSendCount) {
        if (respon != null && respon.isSuccess()) {

            String carNum = null;









            try {
//                carNum = NumberHelp.bytesTohexDesc(respon.getData());
                byte [] datas = respon.getData();

                carNum = ""+ NumberHelp.bytesToLongAsc(new byte[]{datas[4],datas[5],datas[6],datas[7]});
            } catch (Exception e) {
                carNum = null;
            }

            complete(carNum == null ? new InnerResponEntity<String>().fail(carNum, "") : new InnerResponEntity<String>().success(carNum, ""));
        } else {
            complete(new InnerResponEntity<String>().fail(null, ""));
        }

    }

    @Override
    protected CMDWriteData createDataEntity(int requestContinueSendCount) {
        return new CMDWriteData() {
            @Override
            public byte[] getData() {
                return new byte[]{0};
            }

            @Override
            public byte getCmd() {
                return 0x21;
            }
        };
    }

    public SendGetCardNumCMDTask(CardCircuitComSe cardCircuitCom) {
        super(cardCircuitCom, SendGetCardNumCMDTask.class.getName(), !true);
    }









//        super(taskExecutor, SendGetCardNumCMDTask.class.getName(), mTaskManager);









































////                if(!SendGetCardNumCMDTask.this.isComplete()) {mHandler已经removeCallbacksAndMessages(null);所以不用在判断






















////                    DATA[0..1]: *TagType:请求应答,2 个字节的卡片类型 DATA[2]: *Sak:最后一级选择应答的应答

////                    DATA[4..4+ SnrLen]: *Snr:返回卡片的序列号


















//                    complete(carNum == null ? new InnerResponEntity<String>().fail(carNum, "") : new InnerResponEntity<String>().success(carNum, ""));



























































}
